#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
//class A
//{
//private:
//public:
//	int _a;
//};
//
//int main()
//{
//	A* a1 = new A();
//	A* a2 = new A;
//
//	return 0;
//}


class Solution {
public:

    void _hanota(vector<int>& A, vector<int>& B, vector<int>& C, int n)
    {
        if (n == 1)
        {
            C.push_back(A.back());
            A.pop_back();
            return;
        }

        _hanota(A, C, B, n - 1);
        C.push_back(A.back());
        A.pop_back();
        _hanota(B, A, C, n - 1);
    }

    void hanota(vector<int>& A, vector<int>& B, vector<int>& C) {
        _hanota(A, B, C, A.size());
    }
};